0, 0, &x, &y))
return;
- gtk_widget_compute_bounds (child, child, &child_bounds);
+ if (!gtk_widget_compute_bounds (child, child, &child_bounds))
+ return;
if (vadj)
gtk_adjustment_clamp_page (vadj, y, y + child_bounds.size.height);
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
+ graphene_rect_t r;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (icon_area != NULL);
icon_info = priv->icons[icon_pos];
- if (icon_info)
+ if (icon_info &&
+ gtk_widget_compute_bounds (icon_info->widget, GTK_WIDGET (entry), &r))
{
- graphene_rect_t r;
-
- gtk_widget_compute_bounds (icon_info->widget, GTK_WIDGET (entry), &r);
-
*icon_area = (GdkRectangle){
floorf (r.origin.x),
floorf (r.origin.y),
g_array_append_val (backlog_array, *time_coord);
time_coord = &g_array_index (backlog_array, GdkTimeCoord, backlog_array->len - 1);
- gtk_widget_compute_point (gtk_get_event_widget (event),
- gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)),
- &GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X],
- time_coord->axes[GDK_AXIS_Y]),
- &p);
- time_coord->axes[GDK_AXIS_X] = p.x;
- time_coord->axes[GDK_AXIS_Y] = p.y;
+ if (gtk_widget_compute_point (gtk_get_event_widget (event),
+ gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)),
+ &GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X],
+ time_coord->axes[GDK_AXIS_Y]),
+ &p))
+ {
+ time_coord->axes[GDK_AXIS_X] = p.x;
+ time_coord->axes[GDK_AXIS_Y] = p.y;
+ }
+ else
+ {
+ g_array_set_size (backlog_array, backlog_array->len - 1);
+ }
}
*n_elems = backlog_array->len;
if (!priv->adjustment)
return;
- gtk_widget_compute_bounds (GTK_WIDGET (row), GTK_WIDGET (box), &rect);
+ if (!gtk_widget_compute_bounds (GTK_WIDGET (row), GTK_WIDGET (box), &rect))
+ return;
+
y = rect.origin.y;
height = rect.size.height;
header = ROW_PRIV (row)->header;
if (GTK_IS_WIDGET (header) && gtk_widget_is_drawable (header))
{
- gtk_widget_compute_bounds (header, GTK_WIDGET (box), &rect);
- y = rect.origin.y;
- height += rect.size.height;
+ if (gtk_widget_compute_bounds (header, GTK_WIDGET (box), &rect))
+ {
+ y = rect.origin.y;
+ height += rect.size.height;
+ }
}
gtk_adjustment_clamp_page (priv->adjustment, y, y + height);
int w, h;
graphene_rect_t bounds;
- gtk_widget_compute_bounds (widget, GTK_WIDGET (menu), &bounds);
+ if (!gtk_widget_compute_bounds (widget, GTK_WIDGET (menu), &bounds))
+ return FALSE;
+
w = bounds.size.width;
h = bounds.size.height;
if (priv->show_tabs && gtk_notebook_has_current_page (notebook))
{
- gtk_widget_compute_bounds (priv->header_widget,
- GTK_WIDGET (notebook),
- rectangle);
- return TRUE;
+ return gtk_widget_compute_bounds (priv->header_widget,
+ GTK_WIDGET (notebook),
+ rectangle);
}
else
{
if (priv->arrow_widget[i] == NULL)
continue;
- gtk_widget_compute_bounds (priv->arrow_widget[i],
- GTK_WIDGET (notebook),
- &arrow_bounds);
+ if (!gtk_widget_compute_bounds (priv->arrow_widget[i],
+ GTK_WIDGET (notebook),
+ &arrow_bounds))
+ continue;
if (graphene_rect_contains_point (&arrow_bounds,
&(graphene_point_t){x, y}))
GtkNotebookPrivate *priv = notebook->priv;
graphene_rect_t tabs_bounds;
- gtk_widget_compute_bounds (priv->tabs_widget, GTK_WIDGET (notebook), &tabs_bounds);
+ if (!gtk_widget_compute_bounds (priv->tabs_widget, GTK_WIDGET (notebook), &tabs_bounds))
+ return FALSE;
return graphene_rect_contains_point (&tabs_bounds,
&(graphene_point_t){x, y});
if (!gtk_notebook_page_tab_label_is_visible (page))
continue;
- gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &bounds);
-
+ if (!gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &bounds))
+ continue;
if (graphene_rect_contains_point (&bounds, &(graphene_point_t){x, y}))
return children;
priv->drag_begin_x = priv->mouse_x;
priv->drag_begin_y = priv->mouse_y;
- gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &tab_bounds);
-
- priv->drag_offset_x = priv->drag_begin_x - tab_bounds.origin.x;
- priv->drag_offset_y = priv->drag_begin_y - tab_bounds.origin.y;
+ /* tab bounds get set to empty, which is fine */
+ priv->drag_offset_x = priv->drag_begin_x;
+ priv->drag_offset_y = priv->drag_begin_y;
+ if (gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &tab_bounds))
+ {
+ priv->drag_offset_x -= tab_bounds.origin.x;
+ priv->drag_offset_y -= tab_bounds.origin.y;
+ }
}
}
}
y = priv->mouse_y;
is_rtl = gtk_widget_get_direction ((GtkWidget *) notebook) == GTK_TEXT_DIR_RTL;
- children = priv->children;
last_child = NULL;
- while (children)
+ for (children = priv->children; children; children = children->next)
{
page = children->data;
{
graphene_rect_t tab_bounds;
- gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &tab_bounds);
+ if (!gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &tab_bounds))
+ continue;
switch (priv->tab_pos)
{
last_child = children->next;
}
-
- children = children->next;
}
return last_child;
gtk_widget_unparent (tab_label);
priv->dnd_child = tab_label;
- gtk_widget_compute_bounds (priv->dnd_child, priv->dnd_child, &bounds);
- gtk_widget_set_size_request (priv->dnd_child,
- ceilf (bounds.size.width),
- ceilf (bounds.size.height));
+ if (gtk_widget_compute_bounds (priv->dnd_child, priv->dnd_child, &bounds))
+ gtk_widget_set_size_request (priv->dnd_child,
+ ceilf (bounds.size.width),
+ ceilf (bounds.size.height));
gtk_style_context_add_class (gtk_widget_get_style_context (priv->dnd_child), "background");
break;
}
- gtk_widget_compute_bounds (priv->cur_page->tab_widget, priv->cur_page->tab_widget, &drag_bounds);
+ if (!gtk_widget_compute_bounds (priv->cur_page->tab_widget, priv->cur_page->tab_widget, &drag_bounds))
+ graphene_rect_init_from_rect (&drag_bounds, graphene_rect_zero ());
left_x = CLAMP (priv->mouse_x - priv->drag_offset_x,
allocation->x, allocation->x + allocation->width - drag_bounds.size.width);
GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
int extra = 0;
- gtk_widget_compute_bounds (priv->handle_widget, GTK_WIDGET (paned), area);
+ if (!gtk_widget_compute_bounds (priv->handle_widget, GTK_WIDGET (paned), area))
+ return;
if (!gtk_paned_get_wide_handle (paned))
extra = HANDLE_EXTRA_SIZE;
return;
child = gtk_bin_get_child (GTK_BIN (popover));
- gtk_widget_compute_bounds (child, GTK_WIDGET (popover), &child_bounds);
-
- if (!graphene_rect_contains_point (&child_bounds,
+ if (!gtk_widget_compute_bounds (child, GTK_WIDGET (popover), &child_bounds) ||
+ !graphene_rect_contains_point (&child_bounds,
&(graphene_point_t){x, y}))
gtk_popover_popdown (popover);
}
{
graphene_rect_t r;
- gtk_widget_compute_bounds (priv->widget, priv->widget, &r);
+ if (!gtk_widget_compute_bounds (priv->widget, priv->widget, &r))
+ return FALSE;
rect->x = floorf (r.origin.x);
rect->y = floorf (r.origin.y);
g_return_if_fail (GTK_IS_RANGE (range));
g_return_if_fail (range_rect != NULL);
- gtk_widget_compute_bounds (priv->trough_widget, GTK_WIDGET (range), &r);
-
- *range_rect = (GdkRectangle) {
- floorf (r.origin.x),
- floorf (r.origin.y),
- ceilf (r.size.width),
- ceilf (r.size.height),
- };
+ if (!gtk_widget_compute_bounds (priv->trough_widget, GTK_WIDGET (range), &r))
+ {
+ *range_rect = (GdkRectangle) { 0, 0, 0, 0 };
+ }
+ else
+ {
+ *range_rect = (GdkRectangle) {
+ floorf (r.origin.x),
+ floorf (r.origin.y),
+ ceilf (r.size.width),
+ ceilf (r.size.height),
+ };
+ }
}
/**
g_return_if_fail (GTK_IS_RANGE (range));
- gtk_widget_compute_bounds (priv->slider_widget, GTK_WIDGET (range), &slider_bounds);
+ if (!gtk_widget_compute_bounds (priv->slider_widget, GTK_WIDGET (range), &slider_bounds))
+ {
+ if (slider_start)
+ *slider_start = 0;
+ if (slider_end)
+ *slider_end = 0;
+ return;
+ }
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
gint slider_length;
graphene_rect_t slider_bounds;
- gtk_widget_compute_bounds (priv->slider_widget, priv->slider_widget, &slider_bounds);
+ if (!gtk_widget_compute_bounds (priv->slider_widget, priv->slider_widget, &slider_bounds))
+ graphene_rect_init (&slider_bounds, 0, 0, gtk_widget_get_width (priv->trough_widget), gtk_widget_get_height (priv->trough_widget));
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
{
graphene_rect_t slider_bounds;
- gtk_widget_compute_bounds (priv->slider_widget, priv->trough_widget, &slider_bounds);
+ if (!gtk_widget_compute_bounds (priv->slider_widget, priv->trough_widget, &slider_bounds))
+ return GDK_EVENT_STOP;
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
priv->slide_initial_slider_position = slider_bounds.origin.y;
guint button;
GdkModifierType state_mask;
GtkWidget *mouse_location;
- graphene_rect_t slider_bounds;
if (!gtk_widget_has_focus (widget))
gtk_widget_grab_focus (widget);
source_device = gdk_event_get_source_device ((GdkEvent *) event);
source = gdk_device_get_source (source_device);
- gtk_widget_compute_bounds (priv->slider_widget, priv->slider_widget, &slider_bounds);
-
g_object_get (gtk_widget_get_settings (widget),
"gtk-primary-button-warps-slider", &primary_warps,
NULL);
(!primary_warps && button == GDK_BUTTON_MIDDLE)))
{
int slider_range_x, slider_range_y;
+ graphene_rect_t slider_bounds;
gtk_widget_translate_coordinates (priv->trough_widget, widget,
priv->slider_x, priv->slider_y,
&slider_range_x, &slider_range_y);
/* If we aren't fixed, center on the slider. I.e. if this is not a scale... */
- if (!priv->slider_size_fixed)
+ if (!priv->slider_size_fixed &&
+ gtk_widget_compute_bounds (priv->slider_widget, priv->slider_widget, &slider_bounds))
{
slider_range_x += (slider_bounds.size.width / 2);
slider_range_y += (slider_bounds.size.height / 2);
gint mouse_y)
{
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
+ graphene_rect_t trough_bounds;
gdouble delta;
gdouble c;
gdouble new_value;
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
mouse_x, mouse_y, &mouse_x, &mouse_y);
- if (priv->zoom)
+ if (priv->zoom &&
+ gtk_widget_compute_bounds (priv->trough_widget, priv->trough_widget, &trough_bounds))
{
- graphene_rect_t trough_bounds;
-
- gtk_widget_compute_bounds (priv->trough_widget, priv->trough_widget, &trough_bounds);
-
zoom = MIN(1.0, (priv->orientation == GTK_ORIENTATION_VERTICAL ?
trough_bounds.size.height : trough_bounds.size.width) /
(gtk_adjustment_get_upper (priv->adjustment) -
gtk_adjustment_get_lower (priv->adjustment) -
gtk_adjustment_get_page_size (priv->adjustment)));
+
/* the above is ineffective for scales, so just set a zoom factor */
if (zoom == 1.0)
zoom = 0.25;
{
graphene_rect_t slider_bounds;
- gtk_widget_compute_bounds (priv->slider_widget, GTK_WIDGET (range), &slider_bounds);
+ if (!gtk_widget_compute_bounds (priv->slider_widget, GTK_WIDGET (range), &slider_bounds))
+ graphene_rect_init (&slider_bounds, 0, 0, 0, 0);
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
priv->slide_initial_slider_position = (zoom * (mouse_y - priv->slide_initial_coordinate_delta) - slider_bounds.origin.y) / (zoom - 1.0);
range_height = gtk_widget_get_height (widget);
slider_widget = gtk_range_get_slider_widget (range);
- gtk_widget_compute_bounds (slider_widget, widget, &slider_bounds);
+ if (!gtk_widget_compute_bounds (slider_widget, widget, &slider_bounds))
+ graphene_rect_init (&slider_bounds, 0, 0, gtk_widget_get_width (widget), gtk_widget_get_height (widget));
gtk_widget_measure (priv->value_widget,
GTK_ORIENTATION_HORIZONTAL, -1,
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
graphene_rect_t value_bounds;
- if (!priv->value_widget)
+ if (!priv->value_widget ||
+ !gtk_widget_compute_bounds (priv->value_widget, GTK_WIDGET (scale), &value_bounds))
{
*x = 0;
*y = 0;
return;
}
- gtk_widget_compute_bounds (priv->value_widget, GTK_WIDGET (scale), &value_bounds);
*x = value_bounds.origin.x;
*y = value_bounds.origin.y;
graphene_rect_t indicator_bounds;
gint distance;
- gtk_widget_compute_bounds (indicator->scrollbar, GTK_WIDGET (sw), &indicator_bounds);
+ if (!gtk_widget_compute_bounds (indicator->scrollbar, GTK_WIDGET (sw), &indicator_bounds))
+ return FALSE;
if (indicator->over)
distance = INDICATOR_FAR_DISTANCE;
GtkSwitchPrivate *priv = gtk_switch_get_instance_private (sw);
graphene_rect_t switch_bounds;
- gtk_widget_compute_bounds (GTK_WIDGET (sw), GTK_WIDGET (sw), &switch_bounds);
+ if (!gtk_widget_compute_bounds (GTK_WIDGET (sw), GTK_WIDGET (sw), &switch_bounds))
+ return;
+
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
/* If the press didn't happen in the draggable handle,
tooltip->tooltip_widget = new_tooltip_widget;
toplevel = _gtk_widget_get_toplevel (new_tooltip_widget);
- gtk_widget_compute_bounds (new_tooltip_widget, toplevel, &anchor_bounds);
- anchor_rect = (GdkRectangle) {
- floorf (anchor_bounds.origin.x), floorf (anchor_bounds.origin.y),
- ceilf (anchor_bounds.size.width), ceilf (anchor_bounds.size.height)
- };
+ if (gtk_widget_compute_bounds (new_tooltip_widget, toplevel, &anchor_bounds))
+ {
+ anchor_rect = (GdkRectangle) {
+ floorf (anchor_bounds.origin.x), floorf (anchor_bounds.origin.y),
+ ceilf (anchor_bounds.size.width), ceilf (anchor_bounds.size.height)
+ };
+ }
+ else
+ {
+ anchor_rect = (GdkRectangle) { 0, 0, 0, 0 };
+ }
settings = gtk_settings_get_for_display (display);
g_object_get (settings,
!priv->visible)
return FALSE;
- gtk_widget_compute_bounds (priv->button, priv->tree_view, &button_bounds);
+ if (!gtk_widget_compute_bounds (priv->button, priv->tree_view, &button_bounds))
+ return FALSE;
if (gtk_widget_get_direction (priv->tree_view) == GTK_TEXT_DIR_LTR)
button_bounds.origin.x += button_bounds.size.width - TREE_VIEW_DRAG_WIDTH;
return;
gdk_event_get_coords (event, &x, &y);
- gtk_widget_compute_point (event_widget,
- gtk_widget_get_toplevel (event_widget),
- &GRAPHENE_POINT_INIT (x, y),
- &p);
+ if (!gtk_widget_compute_point (event_widget,
+ gtk_widget_get_toplevel (event_widget),
+ &GRAPHENE_POINT_INIT (x, y),
+ &p))
+ return;
if (event->any.type == GDK_TOUCH_BEGIN ||
event->any.type == GDK_TOUCH_UPDATE ||
g_assert (GTK_IS_WINDOW (parent) || GTK_IS_POPOVER (parent));
- gtk_widget_compute_bounds (widget, parent, &bounds);
- *allocation = (GtkAllocation){
- floorf (bounds.origin.x),
- floorf (bounds.origin.y),
- ceilf (bounds.size.width),
- ceilf (bounds.size.height)
- };
+ if (gtk_widget_compute_bounds (widget, parent, &bounds))
+ {
+ *allocation = (GtkAllocation){
+ floorf (bounds.origin.x),
+ floorf (bounds.origin.y),
+ ceilf (bounds.size.width),
+ ceilf (bounds.size.height)
+ };
+ }
+ else
+ {
+ *allocation = (GtkAllocation) { 0, 0, 0, 0 };
+ }
}
static void
return handled;
}
-static void
+static gboolean
translate_event_coordinates (GdkEvent *event,
- GtkWidget *widget);
+ GtkWidget *widget);
gboolean
_gtk_widget_captured_event (GtkWidget *widget,
const GdkEvent *event)
return TRUE;
event_copy = gdk_event_copy (event);
- translate_event_coordinates (event_copy, widget);
+ if (!translate_event_coordinates (event_copy, widget))
+ {
+ g_object_unref (event_copy);
+ return FALSE;
+ }
return_val = _gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_CAPTURE);
}
}
-static void
+static gboolean
translate_event_coordinates (GdkEvent *event,
GtkWidget *widget)
{
graphene_point_t p;
if (!gdk_event_get_coords (event, &x, &y))
- return;
+ return TRUE;
event_widget = gtk_get_event_widget (event);
- gtk_widget_compute_point (event_widget,
- widget,
- &GRAPHENE_POINT_INIT (x, y),
- &p);
+ if (!gtk_widget_compute_point (event_widget,
+ widget,
+ &GRAPHENE_POINT_INIT (x, y),
+ &p))
+ return FALSE;
gdk_event_set_coords (event, p.x, p.y);
+
+ return TRUE;
}
static gboolean
event_copy = gdk_event_copy (event);
- translate_event_coordinates (event_copy, widget);
+ if (!translate_event_coordinates (event_copy, widget))
+ {
+ g_object_unref (event_copy);
+ return FALSE;
+ }
if (widget == gtk_get_event_target (event_copy))
return_val |= _gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_TARGET);
GtkTextDirection text_direction = GPOINTER_TO_INT (user_data);
float y1, y2;
- gtk_widget_compute_bounds (child1, gtk_widget_get_parent (child1), &child_bounds1);
- gtk_widget_compute_bounds (child2, gtk_widget_get_parent (child2), &child_bounds2);
+ if (!gtk_widget_compute_bounds (child1, gtk_widget_get_parent (child1), &child_bounds1) ||
+ !gtk_widget_compute_bounds (child2, gtk_widget_get_parent (child2), &child_bounds2))
+ return 0;
y1 = child_bounds1.origin.y + (child_bounds1.size.height / 2.0f);
y2 = child_bounds2.origin.y + (child_bounds2.size.height / 2.0f);
int start1, end1;
int start2, end2;
- gtk_widget_compute_bounds (*((GtkWidget **)a), compare->widget, &bounds1);
- gtk_widget_compute_bounds (*((GtkWidget **)b), compare->widget, &bounds2);
+ if (!gtk_widget_compute_bounds (*((GtkWidget **)a), compare->widget, &bounds1) ||
+ !gtk_widget_compute_bounds (*((GtkWidget **)b), compare->widget, &bounds2))
+ return 0;
get_axis_info (&bounds1, compare->axis, &start1, &end1);
get_axis_info (&bounds2, compare->axis, &start2, &end2);
graphene_rect_t old_focus_bounds;
parent = gtk_widget_get_parent (widget);
- gtk_widget_compute_bounds (widget, parent ? parent : widget, &bounds);
+ if (!gtk_widget_compute_bounds (widget, parent ? parent : widget, &bounds))
+ graphene_rect_init (&bounds, 0, 0, 0, 0);
if (old_focus_coords (widget, &old_focus_bounds))
{
graphene_rect_t old_focus_bounds;
parent = gtk_widget_get_parent (widget);
- gtk_widget_compute_bounds (widget, parent ? parent : widget, &bounds);
+ if (!gtk_widget_compute_bounds (widget, parent ? parent : widget, &bounds))
+ graphene_rect_init (&bounds, 0, 0, 0, 0);
if (old_focus_coords (widget, &old_focus_bounds))
{
gtk_snapshot_push_clip (snapshot,
&GRAPHENE_RECT_INIT(0, 0, width, height));
- gtk_widget_compute_bounds (self->widget, self->widget, &bounds);
- graphene_matrix_init_from_2d (&transform,
- width / bounds.size.width, 0.0,
- 0.0, height / bounds.size.height,
- bounds.origin.x, bounds.origin.y);
+ if (gtk_widget_compute_bounds (self->widget, self->widget, &bounds))
+ {
+ graphene_matrix_init_from_2d (&transform,
+ width / bounds.size.width, 0.0,
+ 0.0, height / bounds.size.height,
+ bounds.origin.x, bounds.origin.y);
+ }
+ else
+ {
+ graphene_matrix_init_identity (&transform);
+ }
gtk_snapshot_push_transform (snapshot, &transform);
gtk_widget_snapshot (self->widget, snapshot);
if (self->widget == NULL)
return gdk_paintable_new_empty (0, 0);
- gtk_widget_compute_bounds (self->widget, self->widget, &bounds);
+ if (!gtk_widget_compute_bounds (self->widget, self->widget, &bounds))
+ return gdk_paintable_new_empty (0, 0);
if (self->widget->priv->render_node == NULL)
return gdk_paintable_new_empty (bounds.size.width, bounds.size.height);
double fps;
char *fps_string;
graphene_rect_t bounds;
+ gboolean has_bounds;
int width, height;
double overlay_opacity;
if (GTK_IS_WINDOW (widget))
{
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
- if (child)
- gtk_widget_compute_bounds (child, widget, &bounds);
- else
- gtk_widget_compute_bounds (widget, widget, &bounds);
+ if (!child ||
+ !gtk_widget_compute_bounds (child, widget, &bounds))
+ has_bounds = gtk_widget_compute_bounds (widget, widget, &bounds);
}
else
{
- gtk_widget_compute_bounds (widget, widget, &bounds);
+ has_bounds = gtk_widget_compute_bounds (widget, widget, &bounds);
}
layout = gtk_widget_create_pango_layout (widget, fps_string);
pango_layout_get_pixel_size (layout, &width, &height);
- gtk_snapshot_offset (snapshot, bounds.origin.x + bounds.size.width - width, bounds.origin.y);
+ if (has_bounds)
+ gtk_snapshot_offset (snapshot, bounds.origin.x + bounds.size.width - width, bounds.origin.y);
if (overlay_opacity < 1.0)
gtk_snapshot_push_opacity (snapshot, overlay_opacity);
gtk_snapshot_append_color (snapshot,
&(GdkRGBA) { 1, 1, 1, 1 });
if (overlay_opacity < 1.0)
gtk_snapshot_pop (snapshot);
- gtk_snapshot_offset (snapshot, - bounds.origin.x - bounds.size.width + width, - bounds.origin.y);
+ if (has_bounds)
+ gtk_snapshot_offset (snapshot, - bounds.origin.x - bounds.size.width + width, - bounds.origin.y);
g_free (fps_string);
gtk_widget_add_tick_callback (widget, gtk_fps_overlay_force_redraw, NULL, NULL);
GTK_WIDGET_CLASS (gtk_transform_tester_parent_class)->snapshot (widget, snapshot);
- if (!do_picking)
+ if (!do_picking ||
+ !gtk_widget_compute_bounds (self->test_widget, widget, &child_bounds) ||
+ !gtk_widget_compute_bounds (self->test_widget, self->test_widget, &self_bounds))
return;
- gtk_widget_compute_bounds (self->test_widget, widget, &child_bounds);
- gtk_widget_compute_bounds (self->test_widget, self->test_widget, &self_bounds);
{
const struct {